package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoInsertFill;
import com.sky.annotation.AutoUpdateFill;
import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * The interface Employee mapper.
 */
@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     *
     * @param username the username
     * @return by username
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 通过username查询员工数量，判断username是否重复
     *
     * @param employeeQuery the employee query
     * @return the integer
     */
    Integer selectCount(Employee employeeQuery);

    /**
     * 新增员工
     *
     * @param employee the employee
     */
    @AutoInsertFill
    void insert(Employee employee);

    /**
     * 分頁查詢
     *
     * @param employeeQuery the employee query
     * @return the page
     */
    Page<Employee> selectList(Employee employeeQuery);

    /**
     * 启用或禁用
     *
     * @param employee the employee
     */
    @AutoUpdateFill
    void updateById(Employee employee);

    /**
     * 通过id回显信息
     *
     * @param id the id
     * @return the employee
     */
    @Select("select * from employee where id = #{id}")
    Employee selectById(Long id);
}
